<?php
// +---------------------------------------------------------------------------+
// | This file is part of the KnowledgebasePublisher package                   |
// | KnowledgebasePublisher - web based knowledgebase publisher tool           |
// |                                                                           |
// | Author:  Evgeny Leontev <eleontev@gmail.com>                              |
// | Copyright (c) 2005 Evgeny Leontev                                         |
// |                                                                           |
// | For the full copyright and license information, please view the LICENSE   |
// | file that was distributed with this source code.                          |
// +---------------------------------------------------------------------------+

// full path to admin directory
$app_dir = str_replace('\\', '/', getcwd()) . '/admin/';     // trying to guess 
//$app_dir = $_SERVER['DOCUMENT_ROOT'] . '/kb/admin/';       // manually specify it 


/* DO NOT MODIFY */
require_once $app_dir . 'config.inc.php';
require_once APP_CLIENT_DIR . 'client/inc/common.inc.php';

//xdebug_start_profiling();
//@session_name($conf['session_name']);
session_name($conf['session_name']);
session_start();


$setting = &KBClientModel::getSettings(100);
//$setting['view_format'] = $setting['view_format'];
//$setting['view_template'] = $view['template']; 	// looking for template in this dir
$setting['view_style'] = 'default';			// looking for css with this name


$controller = &new KBClientController();
$controller->setDirVars($setting);
$controller->setModRewrite(!empty($_SERVER['MY_REWRITE']) || $conf['use_mod_rewrite']);
//$controller->setModRewrite(false);
//$controller->extra_params = array('a'=>'28', 'b'=>'137');

$reg->setEntry('controller', $controller);
$manager = &KBClientLoader::getManager($controller, $setting);

$view    = &KBClientLoader::getView($controller, $manager);
//echo "<pre>"; print_r($controller); echo "</pre>";
$page = new KBClientPageRenderer($view, $manager);
$page->display();


if($conf['debug_info']) {
	echo getDebugInfo();
}

if($conf['debug_speed']) {
	timeprint("%min %max graf");
}

ob_end_flush();
?>